﻿namespace BrowserCacheBustingUtilities
{
    using System;
    using System.Text;

    public class ConsoleOutput : IOutput
    {
        public StringBuilder _data = new StringBuilder();

        public void Write(string message)
        {
            Console.Write(message);

            if (!string.IsNullOrWhiteSpace(CacheBuster.OutputFilePath))
                _data.Append(message);
        }

        public void WriteLine(string message)
        {
            Console.WriteLine(message);

            if (!string.IsNullOrWhiteSpace(CacheBuster.OutputFilePath))
                _data.AppendLine(message);
        }

        public void WriteLine()
        {
            Console.WriteLine();

            if (!string.IsNullOrWhiteSpace(CacheBuster.OutputFilePath))
                _data.AppendLine();
        }

        public StringBuilder Data
        {
            get
            {
                return _data;
            }
        }
    }
}
